package com.qf.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.qf.mapper.DtsRegionMapper;
import com.qf.pojo.DtsRegion;
import org.ietf.jgss.Oid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

/**
 * @author Wy
 * @version V1.0
 * @Project MavenDemo
 * @Package com.qf.service
 * @Description:
 * @Date 2022/6/21 10:33
 */
@Service
public class RegionServiceImpl implements  RegionService {

    @Autowired
    private DtsRegionMapper mapper;
    @Override
    public IPage<DtsRegion> queryRegionPage(String name, String code, Integer page, Integer limit) {
        //创建分页对象
         IPage iPage= new Page<>(page,limit);
         //
        QueryWrapper<DtsRegion> objectQueryWrapper = new QueryWrapper<>();
        if(!StringUtils.isEmpty(name)){
            objectQueryWrapper.like("name", name);
        }
        if(!StringUtils.isEmpty(code)){
            objectQueryWrapper.like("code", code);
        }

        IPage iPage1 = mapper.selectPage(iPage, objectQueryWrapper);
        return iPage1;
    }
}
